package com.zcf.controller;


import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zcf.common.json.Body;
import com.zcf.pojo.RoomRecord;
import com.zcf.service.RoomRecordServiceImpl;
import com.zcf.vo.out.LayuiJson;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ZhaoQi
 * @since 2019-03-18
 */
@CrossOrigin
@Controller
@RequestMapping("/roomRecord")
public class RoomRecordController {

	@Autowired
	RoomRecordServiceImpl RoomRecordServiceImpl;
	/**
	 * 后端获取战绩
	 * @param record
	 * @return
	 */
	@PostMapping("getrecord")
	@ResponseBody
	public LayuiJson getrecord(RoomRecord record,@RequestParam(value = "pageNum") int pageNum,
			@RequestParam(value = "pageSize") int pageSize){
		return RoomRecordServiceImpl.getrecord(record,pageNum,pageSize);
	}

	/**
	 * 获取战绩详情
	 * @param record
	 * @return
	 */
	@PostMapping("getRecordInfo")
	@ResponseBody
	public Body getRecordInfo(RoomRecord record){
		return RoomRecordServiceImpl.getRecordInfo(record);
	}
	/**
	 *外围获取战绩
	 * @param record
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	@PostMapping("getRecords")
	@ResponseBody
	public Body getRecords(RoomRecord record,int userid ,@RequestParam(value = "type")int type){
		return RoomRecordServiceImpl.getrecords(record,userid,type);
	}
	/**
	 * 外围获取战绩总览
	 * @param record
	 * @return
	 */
//	@PostMapping("recordoverview")
//	@ResponseBody
//	public Map<String, Object> recordoverview(RoomRecord record){
//		return RoomRecordServiceImpl.recordoverview(record);
//	}
	/**
	 * 获取对局详情
	 * @param record
	 * @return
	 */
	@PostMapping("getnuminfo")
	@ResponseBody
	public Body getnuminfo(RoomRecord record){
		return RoomRecordServiceImpl.getnuminfo(record);
	}

}

